package singleton;

import java.io.Serializable;

/**
 * @program: javase
 * @description: 枚举用做常量，还可以在switch中使用
 * @author: luolidong
 * @create: 2021-06-12 16:09
 * @version: 1.0
 */
public enum EnumTest implements Serializable {
    ADD_SUCCESS("添加成功",200),
    UPDATE_SUCCESS("修改成功",201);
    private String msg;
    private Integer code;

    private EnumTest(String msg, Integer code) {
        this.msg = msg;
        this.code = code;
    }
    private Object readResolve() {
        return ADD_SUCCESS;
    }

    public static void main(String[] args) {
        System.out.println("EnumTest.ADD_SUCCESS = " + EnumTest.ADD_SUCCESS);
        System.out.println("EnumTest.ADD_SUCCESS.msg = " + EnumTest.ADD_SUCCESS.msg);
    }
}
